package com.ofd.sign.domin;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * @author wangrenjie
 */
@Getter
@Setter
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SignRes<T> {

    // t- 成功  false-失败
    private boolean status;

    //签名结果内容
    private T result;

    //status-为f 时返回的具体签章错误消息
    private String errorMessage;


    /**
     * 实例化一个正确的返回
     * @param data
     * @return
     */
    public static <T> SignRes<T> ok(T data) {
        return new SignRes<T>(true, data, null);
    }

    /**
     * 实例化一个正确的返回
     * @param data
     * @return
     */
    public static SignRes fail(String errorMessage) {
        return new SignRes(true,null,errorMessage);
    }

}
